<?php

//English:!! You have to login to flickr by you own hand and set something (add app and callbackurl) in your flickr account ,this could not be done by program only!!,read the readme for detail,most of people fail to use flickr api because they miss this reading no matter they use this class or phpflickr created by other programers.
//Chinese:你必须先登陆flickr去设置callbackurl，大部分人说这些API不能用，原因就是他们省略了去阅读的1分钟，无论他们是用这个phpclass还是用著名的phpflickr,详细请读readme

require_once("./curlflickr.php");//chage to your directory
session_start();
$fk=new curlflickr;
$fk->api_key="976a3ad1d113dbdf455a5c0769ad4b05";
$fk->secret="296fce0850161b5b";
//$fk->sessionname="flickr_session_anything";//define your session if you like,this will help to change to another flickr account
if(empty($_SESSION[$fk->sessionname])){
	$fk->auth("write",TRUE);//or just $fk->auth(); is fine	
}else{//after login , just upload you photos or others,enjoy
//focus method 1 and method 5 is just ok if you think there is too many method.
 
  /*
  //method 1,upload one photo only,
  //remember:large size will only be exist if the photo is large
  $url=$fk->uploadsingle("../email/temp/Blue-20Lingerie_gnd_kayla_full_figured_diva-0110.jpg","array");
   print "<img src='".$url[large]."'  />";
  print "<img src='".$url[medium]."' />";
  */
  
   /*  
  //method 2,,upload one photo only  
  $urls=$fk->uploadsingle("../email/temp/1.jpg","all","this is a title","this is a description");//a long setting ,see the function yourself 
  print_r($urls);
  */
    
  
  /*
  //method 3 , upload single photo
   $url=$fk->uploadsingle("../email/temp/1.jpg","large","this is a title","this is a description");//a long setting ,see the function yourself  
  print_r($url);
  */
  
   /*
  //method 4,upload using your idea ,actually this is a better idea,but will confuse you
  //the uploadsingle method just wrap the following three functions , not anymore
  $photoid=$fk->uploadone($photopath,$title, $description, $tags, $is_public, $is_friend, $is_family);
  $obj=$fk->photos_getInfo($photoid,"flickr.photos.getSizes","sizes");	
	print_r( $fk->buildPhotoURL($obj,$size) );		
      
  */

   /* 
  //method 5 upload multi url, the following photo will upload in a same second!WOW
  //you will see a high performance when there is more than 3 photo , i will musch faster than a loop method using uploadsingle!
  //do not use this method when there is less that 3 photo, though no harm but will be a litte slow and cause more memory
  //this method is not fully debug but i am using it very good on one of my website, if any bug , http://www.trackself.com reply on this blog's anywhere , i will fixed it soon
  //if you have more than 50 upload at a same time , use array_chunk function to set appart them will help to make sure every function is uploaded
   $images[]="../email/temp/Blue-20Lingerie_gnd_kayla_full_figured_diva-0110.jpg";
   $images[]="../email/temp/Blue-20Lingerie_gnd_kayla_full_figured_diva-0120.jpg";
   $images[]="../email/temp/Blue-20Lingerie_gnd_kayla_full_figured_diva-0130.jpg";

   $res=$fk->uploadmulti($images);
   $pids=$fk->cmiphotoid($res,TRUE);
   $infos=$fk->cmiphotoinfo($pids);
   foreach($infos as $key=>$info){
	  $urls[$key]=$fk->buildPhotoURL($info,"large");  
	  //print "<img src='".$url."' /><br />";
   }
   print_r($urls);
   */
   
 
   // method 6 , this is a magic//this is our example,we upload 3 photos once
   $images[]="./1.jpg";
   $images[]="./2.jpg";
   $images[]="./3.jpg";
   $urls=$fk->umulty($images,"large");////all,array,large,small,square,thumbnail,medium is all ok  
   //print_r($urls);
   foreach($urls as $url){
	 print "<img src='".$url."' /><br />";
   }
  /*
  //a debug method , call the function seperately
  print_r($fk->photos_getInfo("4600138369","flickr.photos.getSizes","sizes"));
  */
}
$fk=NULL;
?>